package com.wyy.web;

import com.wyy.pojo.AppreciatesOrder;
import com.wyy.pojo.Users;
import com.wyy.pojo.model.UserModel;
import com.wyy.pojo.model.UserToken;
import com.wyy.response.CommonReturnType;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * @program: gytcb
 * @author: 吴磊
 * @create: 2021-06-02 13:22
 */
@FeignClient(name = "gytcb-user", fallback = UserFeignActionFallBack.class)
public interface UserFeignAction {

    /**
     * 根据用户名称模糊查询用户
     *
     * @param userToken
     * @return
     */
    @RequestMapping(value = "/getUserByNameLike", method = RequestMethod.POST)
    CommonReturnType getUserByNameLike(UserToken userToken);


    /**
     * 检查订单支付状态
     *
     * @param appreciatesOrder
     * @return
     */
    @RequestMapping(value = "/checkOrderStatus", method = RequestMethod.POST)
    CommonReturnType checkOrderStatus(AppreciatesOrder appreciatesOrder);


    /**
     * 获取支付二维码
     *
     * @param appreciatesOrder
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getQrCode", method = {RequestMethod.POST})
    CommonReturnType FacetoFacePay(AppreciatesOrder appreciatesOrder) throws Exception;

    /**
     * 异步回调接口
     *
     * @param mapParams
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/notifyUrl", method = RequestMethod.POST)
    String notifyInterface(Map<String, String> mapParams) throws Exception;


    /**
     * 检查用户是否登录
     *
     * @return
     */
    @RequestMapping(value = "/checkUserIsLogin", method = {RequestMethod.POST})
    CommonReturnType checkUserIsLogin();


    /**
     * 获取所有的用户
     *
     * @return
     */
    @RequestMapping(value = "/getAllUser", method = {RequestMethod.GET})
    CommonReturnType getAllUser();

    /**
     * 用户登录接口
     *
     * @param userModel
     * @return
     */
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    CommonReturnType login(UserModel userModel);


    /**
     * 验证用户名是否存在
     *
     * @param userNickName
     * @return
     */
    @RequestMapping(value = "/checkUserNickName", method = RequestMethod.POST)
    CommonReturnType getUserByUserNickname(String userNickName);

    /**
     * 验证邮箱是否存在
     *
     * @param userEmail
     * @return
     */
    @RequestMapping(value = "/checkUserEmail", method = RequestMethod.POST)
    CommonReturnType getUserByUserEmail(String userEmail);

    /**
     * 用户注册接口
     *
     * @param users
     * @return
     */
    @RequestMapping(value = "/registerUser", method = RequestMethod.POST)
    CommonReturnType registerUser(Users users);


    /**
     * 更新用户头像路径
     *
     * @param file
     * @return
     */
    @RequestMapping(value = "/updateUserFilePath", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    CommonReturnType tokenUpdateUserFilePath(MultipartFile file);


    /**
     * 更新用户信息
     *
     * @param users
     * @return
     */
    @RequestMapping(value = "/updateUserInfo", method = RequestMethod.POST)
    CommonReturnType tokenUpdateUserInfo(Users users);

    /**
     * 验证用户修改密码的时候密码是否正确
     *
     * @param userPassword
     * @return
     */
    @RequestMapping(value = "/checkUserPasswordIsOk", method = RequestMethod.POST)
    CommonReturnType tokenCheckUserPasswordIsOk(String userPassword);


    /**
     * 退出登录
     *
     * @return
     */
    @RequestMapping(value = "/loginOut", method = RequestMethod.POST)
    CommonReturnType loginOut();

    /**
     * 获取用户的详细信息（不包括密码）
     *
     * @param userId
     * @return
     */
    @RequestMapping(value = "/getUserInfo", method = RequestMethod.POST)
    CommonReturnType getUserInfo(String userId);

}
